{extend name="admin/base" /}
{block name="resources"/}
<!--<link rel="stylesheet" href="__STATIC__/lib/spectrum/spectrum.css">-->
{/block}
{block name="main"}
<!-- page -->

<!--tab栏切换-->
<ul class="nav nav-tabs v-nav-tabs add_tab1" role="tablist">

    <li role="presentation" class="active"><a href="#goods_info" aria-controls="goods_info" role="tab" data-toggle="tab" class="flex-auto-center">基本信息</a></li>
    {if $goods_info['goods_type']}
    <li role="presentation"><a href="#goods_attribute" aria-controls="goods_attribute" role="tab" data-toggle="tab" class="flex-auto-center">规格/属性</a></li>
    {/if}
    <li role="presentation"><a href="#goods_detail" aria-controls="goods_detail" role="tab" data-toggle="tab" class="flex-auto-center">商品详情</a></li>
    {if($goods_info['goods_type']==0)}
    <li role="presentation" class="timing_rule"><a href="#timing_rule" aria-controls="timing_rule" role="tab" data-toggle="tab" class="flex-auto-center">计时/次规则</a></li>
    <li role="presentation" class="wechat_card"><a href="#wechat_card" aria-controls="wechat_card" role="tab" data-toggle="tab" class="flex-auto-center">微信卡券</a></li>
    {/if}
    <li role="presentation"><a href="#discount_rule" aria-controls="discount_rule" role="tab" data-toggle="tab" class="flex-auto-center">权限折扣</a></li>
    {if $store eq '1'}
    <li role="presentation"><a href="#cancel_store" aria-controls="cancel_store" role="tab" data-toggle="tab" class="flex-auto-center">核销门店</a></li>
    {/if}
</ul>

<form class="form-horizontal releaseForm widthFixedForm" role="form" id="form1">
    <input type="hidden" id="goodsId" value="{$goods_id}" name="goodsId"/>
    <input type="hidden" id="shop_type" value="{$shop_type}" name="shop_type" />
    <div id="myTabContent" class="tab-content">
        <div class="tab-pane fade active in tab-1" id="goods_info">

            <div class="screen-title2" data-id="t2">
                <span class="text">商品类型</span>
                <span class="text1">商品类型，商品保存后无法修改，请谨慎选择。</span>
            </div>

            <ul class="mb-20 type-select-radio clearfix">
                {if $goods_info.goods_type eq 1}
                <li class="goodType1 {if $goods_info.goods_type eq 1}active{/if}">
                    <div class="radio-label-div">
                        <div class="">
                            <div>实物商品</div>
                            <p class="p1">(物流发货/线下自提)</p>
                        </div>
                        <img src="/public/admin/images/goodType1.png" alt="" class="">
                    </div>
                    <span class="icon-success-sel"><img src="/public/platform/images/goodTypeSel.png" alt=""></span>
                </li>
                {elseif  $goods_info.goods_type eq 3}
                <li class="goodType3  active">
                    <div class="radio-label-div">
                        <div class="">
                            <div>虚拟商品</div>
                            <p class="p1">(无需物流)</p>
                        </div>
                        <img src="/public/platform/images/goodType1.png" alt="" class="">
                    </div>
                    <span class="icon-success-sel"><img src="/public/platform/images/goodTypeSel.png" alt=""></span>
                </li>
                {else}
                        {if $store eq '1'}
                        {if $goods_info.goods_type eq 0}
                        <li class="goodType2 {if $goods_info.goods_type eq 0}active{/if}">
                                <div class="radio-label-div">
                                        <div class="">
                                                <div>计时/次商品</div>
                                                <p class="p1">(线下消费核销码)</p>
                                        </div>
                                        <img src="/public/admin/images/goodType2.png" alt="" class="">
                                </div>
                                <span class="icon-success-sel"><img src="/public/platform/images/goodTypeSel.png" alt=""></span>
                        </li>
                        {/if}
                        {/if}
                {/if}

            </ul>

            <div class="screen-title2" data-id="t2"><span class="text">基本信息</span></div>
            <!--商品分类-->
            <div class="form-group">
                <label class="col-md-2 control-label"><span class="red">*</span>商品分类</label>
                <div class="col-sm-5" id="tbcNameCategory" data-flag="category" cid="{$goods_info.category_id}" data-attr-id="{$goods_info.goods_attribute_id}" cname="{$goods_info.category_name}" data-goods-id="{$goodsid}">

                    <input type="hidden" id="category_id_1" value="{$goods_info.category_id_1}" name="category_id_1">
                    <input type="hidden" id="category_id_2" value="{$goods_info.category_id_2}" name="category_id_2">
                    <input type="hidden" id="category_id_3" value="{$goods_info.category_id_3}" name="category_id_3">
                    <input type="hidden" id="select_name_hidden" name="select_name_hidden" value="{$goods_info.category_name}">
                    <input type="text" value="{$goods_info.category_name}" id="select_cname" name="select_cname" class="form-control J-selectCategory promotion_type" placeholder="请选择分类" required>

                </div>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label">其他分类</label>
                <div class="col-md-5">
                    <div class="other-category clearfix">
                        {if condition="count($goods_info['extend_category']) gt 0" }
                            {foreach $goods_info["extend_category"]  as $vo}
                            <div class="field-item field-item-remove J-extend-category " data-cid="{$vo['extend_category_id']}">{$vo['extend_category_name']}<span><i class="fa fa-remove icon-danger icon"></i></span></div>
                            {/foreach}
                        {/if}
                        
                    </div>
                </div>
            </div>
            <!--商品名称-->
            <div class="form-group">
                <label class="col-md-2 control-label"><span class="red">*</span>商品名称</label>
                <div class="col-sm-8">
                    <input type="text" autocomplete="off" class="form-control" id="txtProductTitle" name="txtProductTitle" value="{$goods_info.goods_name}" required>
                </div>
            </div>
            <!--销售价-->
            <div class="form-group">
                <label class="col-md-2 control-label"><span class="red">*</span>销售价</label>
                <div class="col-sm-8">
                    <div class="input-group w-200">
                        <input type="number" class="form-control promotion_type" id="txtProductSalePrice" name="txtProductSalePrice" value="{$goods_info.price}" required>
                        <span class="input-group-addon">元</span>
                    </div>
                    <div class="help-block mb-0">启用规格后销售价需要在相应规格设置，商城将以该价格销售</div>
                </div>
            </div>
            <!--市场价-->
            <div class="form-group">
                <label class="col-md-2 control-label"><span class="red">*</span>市场价</label>
                <div class="col-sm-8">
                    <div class="input-group w-200">
                        <input type="number" class="form-control promotion_type" id="txtProductMarketPrice"  value="{$goods_info.market_price}"  name="txtProductMarketPrice" required>
                        <span class="input-group-addon">元</span>
                    </div>
                    <div class="help-block mb-0">启用规格后市场价需要在相应规格设置，商城将以该价格划线展示突出与售价的差价。</div>
                </div>
            </div>
            <!--成本价-->
            <div class="form-group">
                <label class="col-md-2 control-label">成本价</label>
                <div class="col-sm-8">
                    <div class="input-group w-200">
                        <input type="number" class="form-control promotion_type" id="txtProductCostPrice" value="{$goods_info.cost_price}" name="txtProductCostPrice">
                        <span class="input-group-addon">元</span>
                    </div>
                    <div class="help-block mb-0">启用规格后成本价需要在相应规格设置，该价格用于计算利润，请如实填写。</div>
                </div>
            </div>
            <!--总库存-->
            <div class="form-group">
                <label class="col-md-2 control-label"><span class="red">*</span>总库存</label>
                <div class="col-sm-8">
                    <div class="input-group w-200">
                        <input type="number" class="form-control promotion_type" value="{$goods_info.stock}" id="txtProductCount" name="txtProductCount" required>
                        <span class="input-group-addon">件</span>
                    </div>
                    <div class="help-block mb-0">启用规格后不能设置</div>
                </div>
            </div>

            <div class="fold-btn mb-20" data-status="1"><i class="icon icon-drop-down mr-04"></i><span class="text-primary set-more">收起更多设置</span></div>
            <div class="fold-field">
                <!--商品品牌-->
                <div class="form-group">
                    <label for="brand_id" class="col-md-2 control-label">商品品牌</label>
                    <div class="col-sm-8">
                        <input type="hidden" id="select_brand_hidden" name="select_brand_hidden" value="{$goods_info.brand_id}">
                        <select class="form-control" name="brandId" id="brand_id">
                            <option value="0">请选择商品品牌</option>
                            {volist name="goodsbrand_list" id="vo"}
                            <option value="{$vo.brand_id}" {if condition="$goods_info['brand_id'] eq $vo['brand_id']"}selected{/if}>{$vo.brand_name}</option>
                            {/volist}
                        </select>
                        <div class="help-block mb-0">商品品牌需要先关联商品品类，请先把商品品类与商品分类进行关联，即可选择相关联的品牌。</div>
                    </div>
                </div>

                <!--商品编号-->
                <div class="form-group">
                    <label class="col-md-2 control-label">商品编号</label>
                    <div class="col-sm-8">
                        <input type="text" autocomplete="off" class="form-control" id="txtProductCodeA" name="txtProductCodeA" value="{$goods_info.code}" notChinese="true">
                    </div>
                </div>
                <!--商品货号-->
                <div class="form-group">
                    <label class="col-md-2 control-label">商品货号</label>
                    <div class="col-sm-8">
                        <input type="text" autocomplete="off" class="form-control" id="item_no" name="item_no" value="{$goods_info.item_no}">
                        <div class="help-block mb-0">启用规格后不能设置</div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">虚拟销量</label>
                    <div class="col-md-8">
                        <div class="input-group w-200">
                            <input type="number" class="form-control" min="0" value="{$goods_info.real_sales}" step="1" name="BasicSales" id="BasicSales">
                            <span class="input-group-addon">件</span>
                        </div>
                        <div class="help-block mb-0">前端显示销量 = 虚拟销量 + 实际销量</div>
                    </div>
                </div>
                <!--商品排序-->
                <div class="form-group">
                    <label for="goodsSort" class="col-md-2 control-label">商品排序</label>
                    <div class="col-sm-8">
                        <input type="text" class="form-control w-200" id="goodsSort" name="goodsSort" value="{$goods_info.sort}">
                        <div class="help-block mb-0">商品排序只会影响店铺商品列表的排序，不会影响商城商品列表排序，越大越靠前。</div>
                    </div>
                </div>
                <!--库存预警-->
                <div class="form-group">
                    <label for="inventoryAlert" class="col-md-2 control-label">库存预警</label>
                    <div class="col-sm-8">
                            <div class="input-group w-200">
                                <span class="input-group-addon">低于</span>
                                <input type="number" class="form-control" min="0" value="{$goods_info.min_stock_alarm}" id="txtMinStockLaram" name="txtMinStockLaram">
                                <span class="input-group-addon">件</span>
                            </div> 
                        <div class="help-block mb-0">商品库存预警数量。可在后台“首页”、“商品=>自营商品=>库存预警”进行查看</div>
                    </div>
                </div>
                <!--商品标签-->
                <div class="form-group">
                    <label class="col-md-2 control-label">商品标签</label>
                    <div class="col-md-8">
                        <div class="checkbox_three">
                            <label class="checkbox-inline"><input class="decorate" type="checkbox" name="goods_labels" id="is_recommend" {if $goods_info['is_recommend'] eq 1}checked{/if}>推荐</label>
                            <label class="checkbox-inline"><input class="decorate" type="checkbox" name="goods_labels" id="is_new" {if $goods_info['is_new'] eq 1}checked{/if}>新品</label>
                            <label class="checkbox-inline"><input class="decorate" type="checkbox" name="goods_labels" id="is_hot" {if $goods_info['is_hot'] eq 1}checked{/if}>热卖</label>
                            <label class="checkbox-inline"><input class="decorate" type="checkbox" name="goods_labels" id="is_promotion" {if $goods_info['is_promotion'] eq 1}checked{/if}>促销</label>
                            <label class="checkbox-inline"><input class="decorate" type="checkbox" name="goods_labels" id="is_shipping_free" {if $goods_info['is_shipping_free'] eq 1}checked{/if}>包邮</label>
                        </div>
                    </div>
                </div>
            </div>

            <div class="screen-title2" data-id="t4"><span class="text">商品图片</span></div>

            <!--商品图片-->
            <div class="form-group">
                <label class="col-md-2 control-label"><span class="red">*</span>商品图片</label>
                <div class="col-sm-8">
                    <div class="">
                        <div class="">
                            <div class="picture-list" id="J-goodspic">
                                {if condition="count($goods_info['img_temp_array']) gt 0" }
                                {foreach $goods_info["img_temp_array"]  as $vo}
                                <a href="javascript:void(0);" id="goods_pic_list" style="margin-right:10px;">
                                    <i class="icon icon-danger" style="right:-15px;" title="删除"></i>
                                    <img src="{:__IMG($vo['pic_cover'])}" />

                                </a>
                                <input type="hidden" name="upload_img_id" value="{$vo['pic_id']}" />
                                {/foreach}
                                {else /}
                                <div class="upload-thumb" id="default_uploadimg">
                                    <img src="ADMIN_IMG/album/default_goods_image_240.gif" />
                                </div>
                                {/if}
                                <a href="javascript:void(0);" class="plus-box" data-toggle="multiPicture"><i class="icon icon-plus"></i></a>

                            </div>
                        </div>
                        <p class="small-muted">第一张为主图，最多上传5张，支持同时上传多张，建议700*700，支持JPG\GIF\PNG格式，最大不超过1M</p>
                    </div>
                    <input type="text" class="visibility" id="visibility1" name="picture" data-visi-type="multiPicture" aria-required="true">
                </div>

            </div>
            <div class="form-group">
                <label class="col-md-2 control-label">主图视频</label>
                <div class="col-md-8">
                    <div class="picture-list" id="pc_video_adv">
                        {if $goods_info['video']}
                        <a href="javascript:void(0);" class="close-box" style="margin-right:10px;">
                            <i class="icon icon-danger" style="right:-15px;" title="删除"></i>
                            <video width="100px" height="100px" src="{:__IMG($goods_info['video'])}"></video>

                        </a>
                        <input type="hidden" name="upload_video_id" id="video_id" value="{$goods_info['video_id']}" />
                        {else /}
                        <a href="javascript:void(0);" class="plus-box" data-toggle="singleVideo"><i class="icon icon-plus"></i></a>
                        {/if}
                    </div>
                    <p class="help-block">建议尺寸为1:1，最好控制在10-30秒以内，视频不能超过5M</p>
                </div>
            </div>

            <div class="screen-title2 " data-id="t7" {if($goods_info['goods_type']!=1)}style="display: none;"{/if}><span class="text">其他信息</span></div>
            <!--运费设置-->
            <div id="shipping_fee_data" {if($goods_info['goods_type']!=1)}style="display: none;"{/if}>
                 <div class="form-group J-shipping_fee">
                    <label class="col-md-2 control-label"><span class="red">*</span>运费设置</label>
                    <div class="col-sm-8">
                        <div class="radio">
                            <label>
                                <input type="radio" name="shipping_fee_type" id="shipping_fee_type" value="0" {if condition = "$goods_info.shipping_fee_type  eq 0"} checked {/if}> 包邮
                            </label>
                        </div>
                        <div class="radio w15">
                            <label>
                                <input type="radio" name="shipping_fee_type" id="shipping_fee_type_2" value="1" {if condition = "$goods_info.shipping_fee_type  eq 1"} checked {/if} >统一邮费

                            </label>
                            <input type="number" id="shipping_fee" name="shipping_fee" class="form-control number-form-control" min="0" placeholder="￥" {if condition = "$goods_info.shipping_fee_type  neq 1"} disabled {/if} value="{$goods_info.shipping_fee}" data-visi-type="prices_1" {if condition = "$goods_info.shipping_fee_type  eq 1"} required {/if}>
                                   <!--<input type="text" id="shipping_fee" value="{$goods_info.shipping_fee}" name="shipping_fee">-->
                        </div>
                        <div class="radio">
                            <label>
                                <input type="radio" name="shipping_fee_type" id="shipping_fee_type_3" value="2" {if condition = "$goods_info.shipping_fee_type  eq 2"} checked {/if}>运费模板
                            </label>
                            <label id="shipping_fee_id-error" class="error dn">请选择运费模板</label>
                            <div class="inline-block">
                                <select class="form-control select-form-control" name="shipping_fee_id" id="shipping_fee_id" data-type ="{$goods_info.shipping_fee_type}" {if condition = "$goods_info.shipping_fee_type  neq 2"} disabled {/if}>
                                        <option value="-1">请选择模板</option>
                                    {foreach name="shipping_list" item="vo"}
                                    <option value="{$vo.shipping_fee_id}" type="{$vo.calculate_type}" {if condition = "$goods_info.shipping_fee_id  eq $vo.shipping_fee_id"} selected {/if}>{$vo.shipping_fee_name}</option>
                                    {/foreach}
                                </select>
                            </div>  
                            <div class="help-block mb-0"> 没有运费模板？去<a href="{:__URL('ADMIN_MAIN/express/freighttemplatelist')}" target="_blank" class="text-primary">新建</a>，新建完点 <a href="javascript:void(0)" class="text-primary J-refresh" data-shipping="{$goods_info.shipping_fee_id}">刷新</a> 重新加载数据</div>
                        </div>
                    </div>
                </div>
                <div class="form-group is_shipping_fee_id hidden">
                    <label class="col-md-2 control-label"></label>
                    <div class="col-md-8">
                        <div class="input-group w-200">
                            <div class="input-group-addon">商品重量</div>
                            <input type="number" class="form-control" name="goods_weight" id="goods_weight" min="0" step="0.01" value="{$goods_info.goods_weight}">
                            <div class="input-group-addon">kg</div>
                        </div>
                    </div>
                </div>
                <div class="form-group is_shipping_fee_id_volume hidden">
                    <label class="col-md-2 control-label"></label>
                    <div class="col-md-8">
                        <div class="input-group w-200">
                            <div class="input-group-addon">商品体积</div>
                            <input type="number" class="form-control" name="goods_volume" id="goods_volume" min="0" step="0.01" value="{$goods_info.goods_volume}">
                            <div class="input-group-addon">m²</div>
                        </div>
                    </div>
                </div>

                <div class="form-group is_shipping_fee_id_num hidden">
                    <label class="col-md-2 control-label"></label>
                    <div class="col-md-8">
                        <div class="input-group w-200">
                            <div class="input-group-addon">商品数量</div>
                            <input type="number" class="form-control" name="goods_count" id="goods_count" min="0" step="1" value="{$goods_info.goods_count}">
                            <div class="input-group-addon">件</div>
                        </div>
                    </div>
                </div>
            </div>
            <!--是否上架-->
            <div class="form-group">
                <label class="col-md-2 control-label"><span class="red">*</span>是否上架</label>
                <div class="col-sm-8">
                    {if $shop_info['base_info']['shop_audit']}
                    <div class="radio">
                        <label>
                            <input type="radio" name="shelves" id="shelves1" value="11" {if $goods_info.state == 11 || $goods_info.state == 1} checked {/if}> 审核通过后上架
                        </label>
                    </div>
                    {else}
                    <div class="radio">
                        <label>
                            <input type="radio" name="shelves" id="shelves1" value="1" {if condition = "$goods_info.state eq 1"} checked {/if}> 立即上架
                        </label>
                    </div>
                    {/if}
                    <div class="radio">
                        <label>
                            <input type="radio" name="shelves" id="shelves2" value="0" {if condition = "$goods_info.state neq 1"} checked {/if}>放入仓库
                        </label>
                    </div>
                </div>
            </div>

        </div>

        <div class="tab-pane fade tab-2" id="goods_attribute">
            <input type="hidden" name="goods_attribute_id" id="goods_attribute_id" value="{$goods_info.goods_attribute_id}">
            <!--规格类型-->
<!--            <div class="form-group">
                <label class="col-md-2 control-label">商品品类</label>
                <div class="col-md-5">
                    <select class="form-control" name="goodsType" id="goodsType" oldSet="{$goods_info.goods_attribute_id}" disabled>
                        <option value="0">请选择商品品类</option>
                        {foreach name="goods_attribute_list" item="attribute"}
                        {if condition="$goods_info.goods_attribute_id == $attribute.attr_id"}
                        <option value="{$attribute.attr_id}" selected="selected">{$attribute.attr_name}</option>
                        {else/}
                        <option value="{$attribute.attr_id}">{$attribute.attr_name}</option>
                        {/if}
                        {/foreach}
                    </select>
                </div>
            </div>-->
            <div class="screen-title2">
                <span class="text">商品规格</span>
            </div>
            <!--商品规格-->
            <div class="form-group">
                <label class="col-md-1 control-label"></label>
                <div class="col-md-10">
                    <table class="v_table_spec" border="1">
                        <tbody id="goods-sku" class="goods-sku js-goods-sku">             
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="form-group">
                        <label class="col-md-1 control-label"></label>
                        <div class="col-md-10">
                            <table class="table v-table table-auto-center table-bordered" id="spec_list">
                                <thead>
                                <th class="w-120">规格名</th>
                                <th class="w-120">展示方式</th>
                                <th>规格项</th>
                                </thead>
                                <tbody>
                                    <tr class="last-tr">
                                        <td colspan="3" class="text-left"><a href="javascript:void(0);" class="goods-value-add" data-show-type="10"><i class="icon icon-add1 mr-04"></i>添加规格</a></td>
                                    </tr>
                                </tbody>
                            </table>
                            <table class="table table-bordered table-auto-center" id="stock_table">
                                <thead></thead>
                                <tbody></tbody>
                                <tfoot>
                                    <tr>
                                        <td colspan="10" class="text-left">
                                            批量修改：
                                            <a href="javascript:void(0);" class="text-primary batchSet" data-batch_type="sku_price">销售价</a>
                                            <a href="javascript:void(0);" class="text-primary batchSet" data-batch_type="market_price">市场价</a>
                                            <a href="javascript:void(0);" class="text-primary batchSet" data-batch_type="cost_price">成本价</a>
                                            <a href="javascript:void(0);" class="text-primary batchSet" data-batch_type="stock_num">库存</a>
                                            <a href="javascript:void(0);" class="text-primary batchSet" data-batch_type="code">商品货号</a>
                                        </td>
                                    </tr>
                                </tfoot>
                            </table>
                        </div>
                    </div>


            <div class="screen-title2">
                        <span class="text">商品属性</span>
                    </div>
                    <div class="form-group">
                        <label class="col-md-1 control-label"></label>
                        <div class="col-md-10">
                            <table class="table v-table table-auto-center table-bordered" id="attribute_list">
                                <thead>
                                <th class="w-120">属性名</th>
                                <th>属性值</th>
                                </thead>
                                <tbody>
                                   <tr class="last-tr">
                                        <td colspan="2" class="text-left">
                                            <a href="javascript:void(0);" class="goods-value-add" data-show-type="11"><i class="icon icon-add1 mr-04"></i>添加属性</a>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
        </div>

        <div class="tab-pane fade tab-3" id="goods_detail">

            <div class="screen-title2" data-id="t5"><span class="text">详细描述</span></div>
            <!--详细描述-->
            <div class="form-group">
                <label class="col-md-2 control-label">详细描述</label>
                <div class="col-md-9">
                    <div class="UE-box">
                        <div id="UE-detail" data-content='{$goods_info.description}'></div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2"></div>
                <label id="description-error" class="error" style="display:none;">请填写商品描述</label>
            </div>

        </div>
        <div class="tab-pane fade tab-7" id="discount_rule">
        <div class="screen-title2" data-id="t3">
            <span class="text">浏览权限</span>
        </div>
        <div class="form-group">
            <label class="col-md-2 control-label">会员等级</label>
            <div class="col-md-5">
                <div class="checkbox_three">
                    <label class="checkbox-inline"><input type="checkbox" name="member_level_all" id="member_level_all" value="0"
                    {if $good_discount['discount_look_obj']['member_level_id']}
                        {if $good_discount['discount_look_obj']['member_level_id'][0] !== 0}
                        {if count($member_level) eq count($good_discount['discount_look_obj']['member_level_id'])}checked{/if}{/if}
                        {elseif $good_discount['discount_look_obj']['member_level_id'] === 0}
                        {else/} checked
                        {/if}
                        >全部</label>
                    {volist name="member_level" id="v1"}
                    <label class="checkbox-inline member_level">
                        <input type="checkbox" name="member_level_id"  value="{$v1.level_id}"
                               {if $good_discount.discount_look_obj}
                               {foreach $good_discount.discount_look_obj.member_level_id as $m1}
                               {if $v1['level_id'] eq $m1} checked="checked" {/if}
                        {/foreach}
                        {/if}>
                        {$v1.level_name}
                    </label>
                    {/volist}
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-md-2 control-label">分销商等级</label>
            <div class="col-md-5">
                <div class="checkbox_three">
                    <label class="checkbox-inline"><input type="checkbox" name="distributor_level_all" id="distributor_level_all" value="0"
                    {if $good_discount['discount_look_obj']['distributor_level_id']}
                        {if $good_discount['discount_look_obj']['distributor_level_id'][0] !== 0}
                        {if count($distributor_level) eq count($good_discount['discount_look_obj']['distributor_level_id'])}checked{/if}{/if}
                        {elseif $good_discount['discount_look_obj']['distributor_level_id'] === 0}
                        {else/} checked
                        {/if}
                        >全部</label>
                    {volist name="distributor_level" id="v2"}
                    <label class="checkbox-inline distributor_level">
                        <input type="checkbox" name="distributor_level_id"  value="{$v2.id}"
                               {if $good_discount.discount_look_obj}
                               {foreach $good_discount.discount_look_obj.distributor_level_id as $m2}
                               {if $v2['id'] eq $m2} checked="checked" {/if}
                        {/foreach}
                        {/if}>
                        {$v2.level_name}
                    </label>
                    {/volist}
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-md-2 control-label">会员标签</label>
            <div class="col-md-5">
                <div class="checkbox_three">
                    <label class="checkbox-inline"><input type="checkbox" name="user_group_level_all" id="user_group_level_all" value="0"
                    {if $good_discount['discount_look_obj']['user_group_level_id']}
                        {if $good_discount['discount_look_obj']['user_group_level_id'][0] !== 0}
                        {if count($user_group_level) eq count($good_discount['discount_look_obj']['user_group_level_id'])}checked{/if}{/if}
                        {elseif $good_discount['discount_look_obj']['user_group_level_id'] === 0}
                        {else/} checked
                        {/if}
                        >全部</label>
                    {volist name="user_group_level" id="v3"}
                    <label class="checkbox-inline user_group_level">
                        <input type="checkbox" name="user_group_level_id"  value="{$v3.group_id}"
                               {if $good_discount.discount_look_obj}
                               {foreach $good_discount.discount_look_obj.user_group_level_id as $m3}
                               {if $v3['group_id'] eq $m3} checked="checked" {/if}
                        {/foreach}
                        {/if}>
                        {$v3.group_name}
                    </label>
                    {/volist}
                </div>
            </div>
        </div>
        <div class="screen-title2" data-id="t3">
            <span class="text">购买权限</span>
        </div>
        <div class="form-group">
            <label class="col-md-2 control-label">会员等级</label>
            <div class="col-md-5">
                <div class="checkbox_three">
                    <label class="checkbox-inline"><input type="checkbox" name="member_level_all2" id="member_level_all2" value="0"
                    {if $good_discount['discount_buy_obj']['member_level_id2']}
                        {if $good_discount['discount_buy_obj']['member_level_id2'][0] !== 0}
                        {if count($member_level) eq count($good_discount['discount_buy_obj']['member_level_id2'])}checked{/if}{/if}
                        {elseif $good_discount['discount_buy_obj']['member_level_id2'] === 0}
                        {else/} checked
                        {/if}
                        > 全部</label>
                    {volist name="member_level" id="w1"}
                    <label class="checkbox-inline member_level2">
                        <input type="checkbox" name="member_level_id2"  value="{$w1.level_id}"
                               {if $good_discount.discount_buy_obj}
                               {foreach $good_discount.discount_buy_obj.member_level_id2 as $n1}
                               {if $w1['level_id'] eq $n1} checked="checked" {/if}
                        {/foreach}
                        {/if}>
                        {$w1.level_name}
                    </label>
                    {/volist}
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-md-2 control-label">分销商等级</label>
            <div class="col-md-5">
                <div class="checkbox_three">
                    <label class="checkbox-inline"><input type="checkbox" name="distributor_level_all2" id="distributor_level_all2" value="0"
                    {if $good_discount['discount_buy_obj']['distributor_level_id2']}
                        {if $good_discount['discount_buy_obj']['distributor_level_id2'][0] !== 0}
                        {if count($distributor_level) eq count($good_discount['discount_buy_obj']['distributor_level_id2'])}checked{/if}{/if}
                        {elseif $good_discount['discount_buy_obj']['distributor_level_id2'] === 0}
                        {else/} checked
                        {/if}
                        > 全部</label>
                    {volist name="distributor_level" id="w2"}
                    <label class="checkbox-inline distributor_level2">
                        <input type="checkbox" name="distributor_level_id2" value="{$w2.id}"
                               {if $good_discount.discount_buy_obj}
                               {foreach $good_discount.discount_buy_obj.distributor_level_id2 as $n2}
                               {if $w2['id'] eq $n2} checked="checked" {/if}
                        {/foreach}
                        {/if}>
                        {$w2.level_name}
                    </label>
                    {/volist}
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-md-2 control-label">会员标签</label>
            <div class="col-md-5">
                <div class="checkbox_three">
                    <label class="checkbox-inline"><input type="checkbox" name="user_group_level_all2" id="user_group_level_all2" value="0"
                    {if $good_discount['discount_buy_obj']['user_group_level_id2']}
                        {if $good_discount['discount_buy_obj']['user_group_level_id2'][0] !== 0}
                        {if count($user_group_level) eq count($good_discount['discount_buy_obj']['user_group_level_id2'])}checked{/if}{/if}
                        {elseif $good_discount['discount_buy_obj']['user_group_level_id2'] === 0}
                        {else/} checked
                        {/if}
                        > 全部</label>
                    {volist name="user_group_level" id="w3"}
                    <label class="checkbox-inline user_group_level2">
                        <input type="checkbox" name="user_group_level_id2"  value="{$w3.group_id}"
                               {if $good_discount.discount_buy_obj}
                               {foreach $good_discount.discount_buy_obj.user_group_level_id2 as $n3}
                               {if $w3['group_id'] eq $n3} checked="checked" {/if}
                        {/foreach}
                        {/if}>
                        {$w3.group_name}
                    </label>
                    {/volist}
                </div>
            </div>
        </div>
        <div class="screen-title2" data-id="t3">
            <span class="text">独立折扣</span>
        </div>
        <div class="form-group distribution_rules">
            <label class="col-md-2 control-label">会员折扣</label>
            <input type="hidden" id="user_discount" value="" name="user_discount">
            <div class="col-md-8" >
                <div class="switch-inline">
                    <input type="checkbox" name="is_member_discount" id="is_member_discount" {if $good_discount.is_member_discount_open}{if $good_discount.is_member_discount_open==1}checked{/if}{/if}>
                    <label for="is_member_discount" class=""></label>
                </div>
                <div class="mb-0 help-block">
                    关闭后该商品不参与会员等级折扣优惠
                </div>
            </div>
        </div>
        <div class="form-group {if !$good_discount || $good_discount.is_member_discount_open==2}hide{/if}" id="user_independents" >
            <label class="col-md-2 control-label">会员独立折扣</label>
            <div class="col-md-8" >
                <div class="switch-inline">
                    <input type="checkbox" name="user_independent" id="user_independent" {if $good_discount.is_user_obj_open && $good_discount.is_user_obj_open==1}checked{/if}>
                    <label for="user_independent" class=""></label>
                </div>
                <div class="mb-0 help-block">
                    开启后会员折扣将优先按独立折扣计算价格，若未开启则按照会员等级设置的折扣计算。
                </div>
            </div>
        </div>
        <div class="form-group {if !$good_discount || $good_discount.is_member_discount_open==2 || $good_discount.is_user_obj_open==2}hide{/if}" id="user_discount_choices">
            <label class="col-md-2 control-label">折扣方式</label>
            <div class="col-md-8" >
                <label class="radio-inline">
                    <input type="radio" name="user_discount_choice" class="user_discount_choice"  value="1"
                           {if !$good_discount || !$good_discount.user_obj.u_discount_choice || $good_discount.user_obj.u_discount_choice == 1} checked {/if}> 打折
                </label>
                <label class="radio-inline">
                    <input type="radio" name="user_discount_choice" class="user_discount_choice" value="2"
                           {if $good_discount.user_obj.u_discount_choice == 2} checked {/if}> 固定金额
                </label>
            </div>
        </div>
        <div class="form-group {if !$good_discount || $good_discount.is_member_discount_open==2 || $good_discount.is_user_obj_open==2 || $good_discount.user_obj.u_discount_choice==2 }hide{/if}" id="user_independent_levels">
            <label class="col-md-2 control-label">会员等级</label>
            <div class="col-md-8">
                {if $good_discount.user_obj}
                {foreach name="$good_discount.user_obj.u_level_data" item="vo1" key="k1" }
                {if $good_discount.user_obj.u_discount_choice==1}
                <div class="input-group w-300">
                    <span class="input-group-addon">{$vo1.name}</span>
                    <input type="number" class="form-control" min="0.01" max="10" name="user_independent_level" value="{$vo1.val}" data-uid="{$k1}" data-uname="{$vo1.name}" >
                    <span class="input-group-addon">折</span>
                </div>
                <br>
                {else/}
                <div class="input-group w-300">
                    <span class="input-group-addon">{$vo1.name}</span>
                    <input type="number" class="form-control" min="0.01" max="10" name="user_independent_level" value="" data-uid="{$k1}" data-uname="{$vo1.name}" >
                    <span class="input-group-addon">折</span>
                </div>
                <br>
                {/if}
                {/foreach}
                {else/}
                {volist name="member_level" id="k1"}
                <div class="input-group w-300">
                    <span class="input-group-addon">{$k1.level_name}</span>
                    <input type="number" class="form-control" min="0.01" max="10" name="user_independent_level"  value="{$k1.goods_discount}" data-uid="{$k1.level_id}" data-uname="{$k1.level_name}">
                    <span class="input-group-addon">折</span>
                </div>
                <br>
                {/volist}
                {/if}
                <div class="mb-0 help-block"> 数值越大，优惠折扣越小, 推荐1-9.9之间的数字,10不打折</div>
            </div>
        </div>
        <div class="form-group {if !$good_discount || $good_discount.is_member_discount_open==2 || $good_discount.is_user_obj_open==2 || $good_discount.user_obj.u_discount_choice==1}hide{/if}" id="user_independent_levels2">
            <label class="col-md-2 control-label">会员等级</label>
            <div class="col-md-8">
                {if $good_discount.user_obj}
                {foreach name="$good_discount.user_obj.u_level_data" item="vo1" key="k1" }
                {if $good_discount.user_obj.u_discount_choice==2}
                <div class="input-group w-300">
                    <span class="input-group-addon">{$vo1.name}</span>
                    <input type="number" class="form-control" min="0" name="user_independent_level2"  value="{$vo1.val}" data-uid="{$k1}" data-uname="{$vo1.name}" >
                    <span class="input-group-addon">元</span>
                </div>
                <br>
                {else/}
                <div class="input-group w-300">
                    <span class="input-group-addon">{$vo1.name}</span>
                    <input type="number" class="form-control" min="0" name="user_independent_level2" value="" data-uid="{$k1}" data-uname="{$vo1.name}" >
                    <span class="input-group-addon">元</span>
                </div>
                <br>
                {/if}
                {/foreach}
                {else/}
                {volist name="member_level" id="k1"}
                <div class="input-group w-300">
                    <span class="input-group-addon">{$k1.level_name}</span>
                    <input type="number" class="form-control" min="0" name="user_independent_level2" value="" data-uid="{$k1.level_id}" data-uname="{$k1.level_name}" >
                    <span class="input-group-addon">元</span>
                </div>
                <br>
                {/volist}
                {/if}
            </div>
        </div>
        <div class="form-group {if !$good_discount || $good_discount.is_member_discount_open==2 || $good_discount.is_user_obj_open==2 || $good_discount.user_obj.u_discount_choice==2}hide{/if}" id="user_independent_switchs">
            <label class="col-md-2 control-label">小数取整</label>
            <div class="col-md-5">
                <div class="switch-inline">
                    <input type="checkbox" id="user_independent_switch" name="is_label_user" value="{$good_discount.user_obj.u_is_label}"  {if $good_discount.user_obj.u_is_label == 1 }checked{/if}>
                    <label for="user_independent_switch"></label>
                </div>
                <div class="help-block mb-0" >折扣后价格小数四舍五入取整，例：198.55取整后199.00，198.46取整后198.00</div>
            </div>
        </div>
        <div class="form-group {if !$good_discount || $good_discount.is_member_discount_open==2}hide{/if}" id="distributor_independents">
            <label class="col-md-2 control-label">分销商独立折扣</label>
            <div class="col-md-8" >
                <div class="switch-inline">
                    <input type="checkbox" name="distributor_independent" id="distributor_independent" {if $good_discount.is_distributor_obj_open==1}checked{/if}>
                    <label for="distributor_independent" class=""></label>
                </div>
                <div class="mb-0 help-block">
                    开启后商品折扣优先以分销商折扣计算，若会员不是分销商则按会员折扣计算
                </div>
            </div>
        </div>
        <div class="form-group {if !$good_discount || $good_discount.is_member_discount_open==2 || $good_discount.is_distributor_obj_open==2}hide{/if}" id="distributor_discount_choices">
            <label class="col-md-2 control-label">折扣方式</label>
            <div class="col-md-8" >
                <label class="radio-inline">
                    <input type="radio" name="distributor_discount_choice" class="distributor_discount_choice"  value="1" {if !$good_discount ||  !$good_discount.distributor_obj.d_discount_choice || $good_discount.distributor_obj.d_discount_choice == 1  }checked{/if}> 打折
                </label>
                <label class="radio-inline">
                    <input type="radio" name="distributor_discount_choice" class="distributor_discount_choice" value="2"  {if $good_discount.distributor_obj.d_discount_choice == 2}checked{/if}> 固定金额
                </label>
            </div>
        </div>
        <div class="form-group {if !$good_discount || $good_discount.is_member_discount_open==2 || $good_discount.is_distributor_obj_open==2 || $good_discount.distributor_obj.d_discount_choice==2 }hide{/if}" id="distributor_independent_levels">
            <label class="col-md-2 control-label">分销商等级</label>
            <div class="col-md-8">
                {if $good_discount.distributor_obj}
                {foreach name="$good_discount.distributor_obj.d_level_data" item="vo2" key="k2" }
                {if $good_discount.distributor_obj.d_discount_choice==1}
                <div class="input-group w-300">
                    <span class="input-group-addon">{$vo2.name}</span>
                    <input type="number" class="form-control" min="0.01" max="10" name="distributor_independent_level"  value="{$vo2.val}" data-uid="{$k2}" data-uname="{$vo2.name}">
                    <span class="input-group-addon">折</span>
                </div>
                <br>
                {else/}
                <div class="input-group w-300">
                    <span class="input-group-addon">{$vo2.name}</span>
                    <input type="number" class="form-control" min="0.01" max="10" name="distributor_independent_level" value="" data-uid="{$k2}" data-uname="{$vo2.name}">
                    <span class="input-group-addon">折</span>
                </div>
                <br>
                {/if}
                {/foreach}
                {else/}
                {volist name="distributor_level" id="k2"}
                <div class="input-group w-300">
                    <span class="input-group-addon">{$k2.level_name}</span>
                    <input type="number" class="form-control" min="0.01" max="10" name="distributor_independent_level"  value="" data-uid="{$k2.id}" data-uname="{$k2.level_name}">
                    <span class="input-group-addon">折</span>
                </div>
                <br>
                {/volist}
                {/if}
                <div class="mb-0 help-block"> 数值越大，优惠折扣越小, 推荐1-9.9之间的数字,10不打折</div>
            </div>
        </div>
        <div class="form-group {if !$good_discount || $good_discount.is_member_discount_open==2 || $good_discount.is_distributor_obj_open==2 || $good_discount.distributor_obj.d_discount_choice==1}hide{/if}" id="distributor_independent_levels2">
            <label class="col-md-2 control-label">分销商等级</label>
            <div class="col-md-8">
                {if $good_discount.distributor_obj}
                {foreach name="$good_discount.distributor_obj.d_level_data" item="vo2" key="k2" }
                {if $good_discount.distributor_obj.d_discount_choice==2}
                <div class="input-group w-300">
                    <span class="input-group-addon">{$vo2.name}</span>
                    <input type="number" class="form-control" min="0" name="distributor_independent_level2" value="{$vo2.val}" data-uid="{$k2}" data-uname="{$vo2.name}">
                    <span class="input-group-addon">元</span>
                </div>
                <br>
                {else/}
                <div class="input-group w-300">
                    <span class="input-group-addon">{$vo2.name}</span>
                    <input type="number" class="form-control" min="0" name="distributor_independent_level2" value="" data-uid="{$k2}" data-uname="{$vo2.name}">
                    <span class="input-group-addon">元</span>
                </div>
                <br>
                {/if}
                {/foreach}
                {else/}
                {volist name="distributor_level" id="k2"}
                <div class="input-group w-300">
                    <span class="input-group-addon">{$k2.level_name}</span>
                    <input type="number" class="form-control" min="0" name="distributor_independent_level2"  value="" data-uid="{$k2.id}" data-uname="{$k2.level_name}">
                    <span class="input-group-addon">元</span>
                </div>
                <br>
                {/volist}
                {/if}
            </div>
        </div>
        <div class="form-group {if !$good_discount || $good_discount.is_member_discount_open==2 || $good_discount.is_distributor_obj_open==2 || $good_discount.distributor_obj.d_discount_choice==2}hide{/if}" id="distributor_independent_switchs">
            <label class="col-md-2 control-label">小数取整</label>
            <div class="col-md-5">
                <div class="switch-inline">
                    <input type="checkbox" id="distributor_independent_switch"  name="is_label_distributor" value="{$good_discount.distributor_obj.d_is_label}" {if $good_discount.distributor_obj.d_is_label == 1}checked{/if}>
                    <label for="distributor_independent_switch"></label>
                </div>
                <div class="help-block mb-0" >折扣后价格小数四舍五入取整，例：198.55取整后199.00，198.46取整后198.00</div>
            </div>
        </div>
    </div>
        <!--计时/次规则-->
        <div class="tab-pane fade tab-5" id="timing_rule">
            <div class="screen-title2" data-id="t3">
                <span class="text">计时/次规则</span>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label"><span class="text-bright">*</span> 单个商品核销次数</label>
                <div class="col-md-8">
                    <input type="number" class="form-control" min="0" name="verification_num" id="verification_num" value="{$goods_info.cancle_times}">
                    <div class="help-block mb-0">0代表不限次数</div>
                </div>

            </div>
            <div class="form-group">
                <label class="col-md-2 control-label"><span class="text-bright">*</span> 卡包模式</label>
                <div class="col-md-8">
                    <label class="radio-inline"><input type="radio" name="card_models" id="card_models1" value="1" {if $goods_info.cart_type eq 1}checked{/if}> 单卡模式</label>
                    <label class="radio-inline"><input type="radio" name="card_models" id="card_models2" value="2" {if $goods_info.cart_type eq 2}checked{/if}> 多卡模式</label>
                    <div class="mb-0 help-block">购买多件时，生成卡券的数量，每张卡券核销次数 = 有单个商品核销次数</div>
                </div>

            </div>
            <div class="form-group">
                <label class="col-md-2 control-label"><span class="text-bright">*</span> 有效类型</label>
                <div class="col-md-5">
                    <label class="radio-inline"><input type="radio" name="effective_type" id="fixed_day" value="1" {if $goods_info.valid_type eq 1}checked{/if} disabled> 固定天数</label>
                    <label class="radio-inline"><input type="radio" name="effective_type" id="overdue_day" value="2" {if $goods_info.valid_type eq 2}checked{/if} disabled> 指定过期日期</label>
                    <div class="mb-0 help-block">商品创建后，不能再选择，请谨慎选择</div>
                </div>
            </div>
            {if($goods_info['valid_type']==1)}
            <div class="form-group effectiveTime">
                <label class="col-md-2 control-label"><span class="text-bright">*</span> 有效时间</label>
                <div class="col-md-5">
                    <div class="input-group w-200">
                        <input type="number" name="effective_day" id="effective_day" class="form-control" min="1" value="{$goods_info.valid_days}">
                        <div class="input-group-addon">天</div>
                    </div>
                </div>
            </div>
            {else}
            <div class="form-group expirationTime hovers">
                <label class="col-md-2 control-label"><span class="text-bright">*</span> 过期时间</label>
                <div class="col-md-5">
                    <div class="date-input-control" style="width: 100%">
                        <input type="text" class="form-control" name="expiration_time" readonly id="expiration_time" placeholder="过期时间" value="{$goods_info.invalid_time}" data-mindate="{$goods_info.invalid_time}"><i class="icon icon-calendar"></i>
                    </div>
                    <div class="mb-0 help-block">过期时间修改时，不能小于当前已保存的过期时间</div>
                </div>
            </div>
            {/if}

        </div>
        <!--微信卡券-->
        <div class="tab-pane fade tab-5" id="wechat_card">
            <div class="form-group">
                <label class="col-md-2 control-label"><span class="text-bright">*</span> 是否开启</label>
                <div class="col-md-5">
                    <div class="switch-inline">
                        <input type="checkbox" id="card_switch" name="card_switch" {if $goods_info['is_wxcard']==1}checked{/if} disabled>
                        <label for="card_switch" class="" ></label>
                    </div>
                    <div class="mb-0 help-block">开启后,用户可以领取微信核销卡券,商品创建后此选项则无法修改</div>
                </div>
                
            </div>
            <div class="wxCard-container flex flex-pack-center mb-20">
                <div class="wxCard-view">
                    <div class="wxCard-bg"></div>
                    <div class="view-main">
                        <div class="view-main-logo" >
                            <img src="/public/platform/images/wx_logo.png" alt="">
                        </div>
                        <div class="padding-15 flex flex-pack-justify word_white mb-20" >
                            <div></div>
                            <div>...</div>
                        </div>
                        <div class="view-main-content">
                            <div class="wxCard_company">广州领客信息科技股份有限公司</div>
                            <div class="wxCard_title line-1-ellipsis">卡券标题</div>
                            <div class="wxCard_used"><a href="javascript:;" class="btn">立即使用</a></div>
                            <div class="wxCard_tips">使用条件：<span>满100使用</span></div>
                            <div class="wxCard_tips">可用时间：<span>周一至周日</span></div>
                            <div class="padding-15 wxCard_imagesTexts">
                                <div class="item-head">
                                    <img src="{$ticket_info.pic_cover}" class="max-w-auto">
                                    <p class="line-1-ellipsis wxCard_describe">详情简述</p>
                                </div>
                            </div>
                            <div class="wxCard_items clearfix">赠送朋友<span class="pull-right" style="padding-top: 2px"><i class="icon icon-right-arrow"></i></span></div>
                            <div class="wxCard_items clearfix">公众号<span class="pull-right" style="padding-top: 2px"><i class="icon icon-right-arrow"></i></span></div>
                            <div class="wxCard_items clearfix">核销情况<span class="pull-right" style="padding-top: 2px"><i class="icon icon-right-arrow"></i></span></div>
                        </div>
                    </div>
                </div>
                <div class="wxCard-editor">
                    <div class="editor-main">

                        <div class="form-group">
                            <div class="col-sm-2 control-label"><span class="text-bright">*</span>卡券标题</div>
                            <div class="col-sm-9">
                                <input class="form-control input-sm diy-bind" id="wxCard_setTitle" disabled value="{$ticket_info.card_title}" name="wxCard_setTitle" value="卡券标题" maxlength="9" placeholder="请输入卡券标题">
                                <p class="help-block mb-0">卡券标题长度不超过9个字</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-2 control-label"><span class="text-bright">*</span>卡券库存</div>
                            <div class="col-sm-9">
                                <input class="form-control input-sm diy-bind" id="wxCard_stock" disabled value="{$goods_info.stock}" name="stock">
                                <p class="help-block mb-0">同步商品库存</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-2 control-label"><span class="text-bright">*</span>卡券颜色</div>
                            <div class="col-sm-9">
                                <div class="date-input-control" style="width: 100%">
                                    <input class="form-control input-sm diy-bind cart_color" id="cart_color" readonly style="color:{$ticket_info.card_color};background:{$ticket_info.card_color}" name="cart_color" disabled>
                                    <i class="icon icon-bottom"></i>
                                    <div class="wx_colorBox">
                                        <a href="javascript:void(0);" class="wx_colorBox_item" data-color="Color010" data-colorNmme="#63b359"></a>
                                        <a href="javascript:void(0);" class="wx_colorBox_item" data-color="Color020" data-colorNmme="#2c9f67"></a>
                                        <a href="javascript:void(0);" class="wx_colorBox_item" data-color="Color030" data-colorNmme="#509fc9"></a>
                                        <a href="javascript:void(0);" class="wx_colorBox_item" data-color="Color040" data-colorNmme="#5885cf"></a>
                                        <a href="javascript:void(0);" class="wx_colorBox_item" data-color="Color050" data-colorNmme="#9062c0"></a>
                                        <a href="javascript:void(0);" class="wx_colorBox_item" data-color="Color060" data-colorNmme="#d09a45"></a>
                                        <a href="javascript:void(0);" class="wx_colorBox_item" data-color="Color070" data-colorNmme="#e4b138"></a>
                                        <a href="javascript:void(0);" class="wx_colorBox_item" data-color="Color080" data-colorNmme="#ee903c"></a>
                                        <a href="javascript:void(0);" class="wx_colorBox_item" data-color="Color081" data-colorNmme="#f08500"></a>
                                        <a href="javascript:void(0);" class="wx_colorBox_item" data-color="Color082" data-colorNmme="#a9d92d"></a>
                                        <a href="javascript:void(0);" class="wx_colorBox_item" data-color="Color090" data-colorNmme="#dd6549"></a>
                                        <a href="javascript:void(0);" class="wx_colorBox_item" data-color="Color100" data-colorNmme="#cc463d"></a>
                                        <a href="javascript:void(0);" class="wx_colorBox_item" data-color="Color101" data-colorNmme="#cf3e36"></a>
                                        <a href="javascript:void(0);" class="wx_colorBox_item" data-color="Color102" data-colorNmme="#5E6671"></a>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-2 control-label"><span class="text-bright">*</span>详情封面</div>
                            <div class="col-sm-9">
                                <div class="picture-list" id="wx_des_pic">
                                    <img src="{$ticket_info.pic_cover}" style="width:100px;height:100px;">
                                    <input type="text" class="visibility" data-visi-type="singlePicture" name="picture-wx_des_pic">
                                </div>
                                <p class="help-block mb-0">图片建议尺寸：850像素*350像素，大小不超过2M。</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-2 control-label"><span class="text-bright">*</span>详情简述</div>
                            <div class="col-sm-9">
                                <input class="form-control input-sm diy-bind" id="wxCard_des" name="wxCard_des" disabled value="{$ticket_info.card_descript}" maxlength="12">
                                <p class="help-block mb-0">封面简介长度不超过12个字</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-2 control-label">商户服务</div>
                            <div class="col-sm-10">
                                <div class="checkbox_three">
                                	{php}$store_service = ['BIZ_SERVICE_FREE_WIFI'=>'免费wifi','BIZ_SERVICE_WITH_PET'=>'可带宠物','BIZ_SERVICE_FREE_PARK'=>'停车位','BIZ_SERVICE_DELIVER'=>'外卖服务'];{/php}
                                    {volist name="ticket_info['store_service']" id="vo"}
                                    <label class="checkbox-inline">{$store_service[$vo]}</label>
                                    {/volist}
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-2 control-label"><span class="text-bright">*</span>操作提示</div>
                            <div class="col-sm-9">
                                <input class="form-control input-sm diy-bind" id="op_tips" name="op_tips" disabled value="{$ticket_info.op_tips}" maxlength="16">
                                <p class="help-block mb-0">建议引导用户到店出示卡券，由店员完成核销操作，长度不超过16个字</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-2 control-label">转赠设置</div>
                            <div class="col-sm-9">
                                <div>
                                    <label class="radio-inline"><input type="radio" name="make_money" value="1" {if $ticket_info.send_set eq 1}checked{/if} disabled> 开启</label>
                                    <label class="radio-inline"><input type="radio" name="make_money" value="2" {if $ticket_info.send_set eq 2}checked{/if} disabled> 关闭</label>
                                </div>
                                <p class="help-block mb-0">开启后，卡券可以转赠给好友</p>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>

        <!--核销门店-->
        <div class="tab-pane fade tab-5" id="cancel_store">
            <div class="screen-title2" data-id="t3">
                <span class="text">核销门店</span>
            </div>
            <div class="form-group">
                <label class="col-md-2 control-label">核销门店</label>
                <div class="col-md-8" style="width: 740px;">
                    <div class="transfer-box">
                        <div class="item">
                            <div class="transfer-title">
                                <div class="checkbox line-1-ellipsis">
                                    <label><input type="checkbox" name="store_unselect_all" value="">未选中门店</label>
                                </div>
                            </div>
                            <div class="transfer-search">
                                <div class="transfer-search-div padding-10" style="padding-bottom: 0">
                                    <input type="text" name="store_unselect_search" class="form-control" placeholder="请选择门店" id="store_unselect_search">
                                    <i class="icon icon-custom-search search_button"></i>
                                </div>
                            </div>
                            <div id="store_unselect" class="heights"></div>
                        </div>
                        <div class="item">
                            <div class="transfer-title">
                                <div class="checkbox line-1-ellipsis">已选中门店</div>
                            </div>
                            <div class="transfer-search">
                                <div class="transfer-search-div padding-10" style="padding-bottom: 0">
                                    <input type="text" name="store_select_search" class="form-control" placeholder="请选择门店" id="store_select_search">
                                    <i class="icon icon-custom-search search_button"></i>
                                </div>
                            </div>
                            <div id="store_select" class="heights"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
    <div class="form-group">
        <div class="col-md-2"></div>
        <div class="col-md-5">
            <div class="add_back">
                <div>
                    <button type="submit" id="btnSave" class="btn">保存</button>
                    <a href="{:__URL('ADMIN_MAIN/goods/goodslist')}" class="btn back">返回</a>
                </div>
            </div>
        </div>
    </div>


</form>
<input id="level_ids" type="hidden" name="level_ids" value="{$level_ids}">
<input type="hidden" id="default_distribution_rule"  name="default_distribution_rule"  value="{if $goods_info.distribution_rule}{$goods_info.distribution_rule}{else}2{/if}">
<input type="hidden" id="default_bonus_rule" name="default_bonus_rule" value="{if $goods_info.bonus_rule}{$goods_info.bonus_rule}{else}2{/if}">
<input type="hidden" id="promotion_type" name="promotion_type" value="{if $goods_info.promotion_type}{$goods_info.promotion_type}{else}0{/if}" />
<!-- page end -->


<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width: 600px">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">添加规格</h4>
            </div>
            <div class="modal-body" style="height: 380px;overflow-y:scroll">
                <form class="form-horizontal" role="form">
                    <!--规格名称-->
                    <div class="form-group">
                        <label for="spec_name" class="col-sm-3 control-label">规格名称</label>
                        <div class="col-sm-8">
                            <input type="text" class="form-control" id="spec_name" value="">
                        </div>
                    </div>
                    <!--规格排序-->
                    <div class="form-group">
                        <label for="sku_sort" class="col-sm-3 control-label">规格排序</label>
                        <div class="col-sm-8">
                            <input id="sku_sort" type="text" value="" onkeyup='this.value = this.value.replace(/\D/gi, "")' class="form-control">
                        </div>
                    </div>
                    <!--是否启用-->
                    <div class="form-group">
                        <label class="col-sm-3 control-label">是否启用</label>
                        <div class="col-sm-8">
                            <!--<label><input id="is_visible" class="mui-switch mui-switch-animbg"  type="checkbox" style="outline: none;"> </label>-->
                            <div class="switch-inline">
                                <input type="checkbox" id="is_visible">
                                <label for="is_visible" class=""></label>
                            </div>
                        </div>
                    </div>
                    <!--展示方式-->
                    <div class="form-group">
                        <label class="col-sm-3 control-label">展示方式</label>
                        <div class="col-sm-8">
                            <label class="radio-inline">
                                <input type="radio" name="show_type" id="show_type1" value="1" checked> 文字
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="show_type" id="show_type2" value="2"> 颜色
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="show_type" id="show_type3" value="3"> 图片
                            </label>
                        </div>
                    </div>
                    <div class="form-group addspec_table">
                        <div class="col-sm-3" style="text-align: right;">
                            <a href="javascript:void(0);" class="addSpec">增加规格值</a>
                        </div>
                        <div class="col-sm-8">
                            <table class="table v-table table-bordered">
                                <thead>
                                    <tr>
                                        <th>规格值</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody class="tbContent trs">
                                    <tr class="spec_data">
                                        <td class="w50"><input type="text" name="spec_value" class="w50"></td>
                                        <td class="w50"><a href="javascript:void(0);" class="del">删除</a></td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>

                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary addgood1">确定</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>

    </div>
</div>
<div class="modal fade" id="addAttrValue" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width: 600px">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">添加属性</h4>
            </div>
            <div class="modal-body" style="height: 150px;">
                <form class="form-horizontal" role="form">
                    <!--规格名称-->
                    <div class="form-group">
                        <label for="attr_name" class="col-sm-3 control-label">属性名称</label>
                        <div class="col-sm-8">
                            <input type="text" class="form-control" id="attr_name" value="">
                        </div>
                    </div>
                    <!--规格排序-->
                    <div class="form-group">
                        <label for="attr_sort" class="col-sm-3 control-label">属性排序</label>
                        <div class="col-sm-8">
                            <input id="attr_sort" type="text" value="" onkeyup='this.value = this.value.replace(/\D/gi, "")' class="form-control">
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary addgood2">确定</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>

    </div>
</div>
</body>
<!-- /.modal -->
{/block}
{block name="script"}
<script>
	var storeListUrl = "{$storeListUrl}";
	var storeStatus =  "{$store}";
    require(['utilAdmin', 'adminAddgood'], function (utilAdmin, adminAddgood) {
        var goods_type = '{$goods_info.goods_type}';
        var obj = {$goods_info};
        $(function () {

            //初始化规格图片记录数组
            var groupIdArray = eval('{$goods_info.goods_group_list}');
            var $selDiv = $("#productcategory-selected");
            var $lis = $("#procategory li");
            var html = "";
            for (var $i = 0; $i < groupIdArray.length; $i++) {
                var groupId = groupIdArray[$i]["group_id"];
                var name = groupIdArray[$i]["group_name"];
                html += "<span class='label' id='" + groupId + "' group_name='" + name + "'>" + name + "<i class='categoryclose'></i></span>";
            }

            $selDiv.append(html);
            if ($('#J-goodspic').find("input[name='upload_img_id']").length > 4) {
                $('#J-goodspic').find(".plus-box").hide();
            }

        })
        // 有图片则开启验证
        $('#J-goodspic').bind('DOMNodeInserted',function(e){
        var lengths=$(this).find("input[name='upload_img_id']").length;
        if(lengths > 0){
            $('.visibility').removeAttr('required');
        }
        if(lengths>4){
            $(this).find(".plus-box").fadeOut();
        }
    });
     $('#J-goodspic').bind('DOMNodeRemoved',function(e){
        var lengths=$(this).find("input[name='upload_img_id']").length;
        if(lengths < 1){
            $('.visibility').attr('required','required');
        }
        if(lengths<5){
            $(this).find(".plus-box").show();
        }
     });
        adminAddgood.goodsSkuCreate(obj);
        utilAdmin.validate("#form1");

        utilAdmin.layDate("#expiration_time");
        // 双向绑定数据
        $('#wxCard_setTitle').bind('input propertychange change', function () {
            var val = $(this).val();
            $('.wxCard_title').html(val);
        });
        $('#wxCard_des').bind('input propertychange change', function () {
            var val = $(this).val();
            $('.wxCard_describe').html(val);
        });
        // 点击选择卡券颜色使颜色变化
        $('.wx_colorBox').on('click', '.wx_colorBox_item', function () {
            var color = $(this).attr('data-colornmme');
            $('.cart_color').css('background', color);
            $('.wxCard-view .view-main').css('background', color);
            $('.wxCard_used .btn').css('background', color);
            $('.wx_colorBox').hide();
        });
        $('.cart_color').on('click', function () {
            $('.wx_colorBox').show();
        })
        //预加载
        if (goods_type == 0) {
            $(this).addClass('active').siblings().removeClass('active');
            $("#verification_num").attr('required','required');
            $("#effective_day").attr('required','required');
            $(".store_list").attr('required','required');
        }

        var valid_type = '{$goods_info.valid_type}';
        if (valid_type == 1) {
            $('.effectiveTime').removeClass('hovers');
            $('.expirationTime').addClass('hovers');
            $('#effective_day').attr('required', 'required');
            $('#expiration_time').removeAttr('required');
        } else {
            $('.effectiveTime').addClass('hovers');
            $('.expirationTime').removeClass('hovers');
            $('#expiration_time').attr('required', 'required');
            $('#effective_day').removeAttr('required');
        }


        var is_wxcard = '{$goods_info.is_wxcard}';
        if (is_wxcard == 1) {
            $('.wxCard-container').removeClass('hovers');
            $("#wxCard_setTitle").attr('required', 'required');
            $("#wxCard_stock").attr('required', 'required');
            $("#wxCard_des").attr('required', 'required');
            $("#op_tips").attr('required', 'required');
            //初始化颜色
            var wx_color = '{$ticket_info.card_color}';
            $('.wxCard-view .view-main').css('background', wx_color);
            $('.wxCard_used .btn').css('background', wx_color);
        } else {
            $('.wxCard-container').addClass('hovers');
            $("#wxCard_setTitle").removeAttr('required');
            $("#wxCard_stock").removeAttr('required');
            $("#wxCard_des").removeAttr('required');
            $("#op_tips").removeAttr('required');
        }

        $(document).click(function (e) {
            var target = $(e.target);
            if (target.closest(".cart_color").length == 0) {
                $('.wx_colorBox').hide();
            }
        });
        $("input[name='effective_type']").on('change', function () {
            var val = $(this).val();
            if (val == 0) {
                $('.effectiveTime').removeClass('hovers');
                $('.expirationTime').addClass('hovers');
                $('#effective_day').attr('required', 'required');
                $('#expiration_time').removeAttr('required');
            }
            if (val == 1) {
                $('.effectiveTime').addClass('hovers');
                $('.expirationTime').removeClass('hovers');
                $('#expiration_time').attr('required', 'required');
                $('#effective_day').removeAttr('required');
            }
        })
        $("input[name='card_model']").on('change', function () {
            var val = $(this).val();
            if (val == 0) {
                $('.wxCard-container').removeClass('hovers');
                $("#wxCard_setTitle").attr('required', 'required');
                $("#wxCard_stock").attr('required', 'required');
                $("#wxCard_des").attr('required', 'required');
                $("#op_tips").attr('required', 'required');
            }
            if (val == 1) {
                $('.wxCard-container').addClass('hovers');
                $("#wxCard_setTitle").removeAttr('required');
                $("#wxCard_stock").removeAttr('required');
                $("#wxCard_des").removeAttr('required');
                $("#op_tips").removeAttr('required');
            }
        })

    })
</script>
{/block}